import {defineStore} from "pinia";
import {UserVo} from "@/dto/User/User.ts";

const STORE = "User";
export const useUserStore = defineStore(STORE, {
    state: () => {
        return {
            token: "",
            userVo:new UserVo(),
            roleList:[] as Array<string>
        }
    },
    actions: {
        getToken() {
            return this.token
        },
        setToken(token:string){
            this.token = token
        },
        getUser() {
            return this.userVo
        },
        setUser(userVo:UserVo){
            this.userVo = userVo
        },
        getRoleList(){
            return this.roleList
        },
        setRoleList(roleList?:Array<string>){
            this.roleList = roleList ?? []
        }
    }
})